package cn.iocoder.yudao.module.ao.dal.mysql.SysClass;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ao.dal.dataobject.SysClass.SysClassDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ao.controller.admin.SysClass.vo.*;

/**
 * 班级信息 Mapper
 *
 * @author 智教云枢
 */
@Mapper
public interface SysClassMapper extends BaseMapperX<SysClassDO> {

    default PageResult<SysClassDO> selectPage(SysClassPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SysClassDO>()
                .eqIfPresent(SysClassDO::getMajorId, reqVO.getMajorId())
                .eqIfPresent(SysClassDO::getEnrollmentTermId, reqVO.getEnrollmentTermId())
                .likeIfPresent(SysClassDO::getClassName, reqVO.getClassName())
                .eqIfPresent(SysClassDO::getClassCode, reqVO.getClassCode())
                .eqIfPresent(SysClassDO::getGrade, reqVO.getGrade())
                .eqIfPresent(SysClassDO::getHeadteacherId, reqVO.getHeadteacherId())
                .eqIfPresent(SysClassDO::getCounselorId, reqVO.getCounselorId())
                .eqIfPresent(SysClassDO::getStudentCount, reqVO.getStudentCount())
                .eqIfPresent(SysClassDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(SysClassDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(SysClassDO::getClassCode));
    }

}